function showPic (whichpic) {
	
	if(!document.getElementById("placeholder")) return false;	

	var placeholder = document.getElementById("placeholder");
	if(placeholder.nodeName != "IMG") return false;
	
	var source = whichpic.getAttribute("href");
	placeholder.setAttribute("src", source);

	if(document.getElementById("description"))
	{
		var title = whichpic.getAttribute("title") ? whichpic.getAttribute("title") : "";
		var desc = document.getElementById("description");
		if(desc.firstChild.nodeType == 3)
		{
			desc.firstChild.nodeValue = title;	
		}			
	}

	return true;
}

function prepareGallery () {
	
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("imagegallery")) return false;	
			
	var gallery = document.getElementById("imagegallery");
	var links = gallery.getElementsByTagName("a");
	for (var i=0;i<links.length;i++) {
		links[i].onclick = function(){
			return showPic(this) ? false : true;			
		}
	}
}

function addLoadEvent (func) {
	
	var oldonload = window.onload;
	if(typeof window.onload != "function")
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}